You can now implement a movie data export component by calling the new MovieExportFromProceduresToDataRef function.
Because many existing applications expect to be able to perform an export operation from a movie or track, export components should support MovieExportToFile , MovieExportFromProceduresToDataRef and MovieExportToDataRef . Using the routines described in "Functions Provided by the QuickTime Movie Export Component" , it is possible to provide small implementations of these old-style routines that simply call the newer MovieExportFromProceduresToDataRef to perform the actual operation.
Listing 13 shows how to implement MovieExportToFile so that it simply calls MovieExportToDataRef .
Listing 13 Calling MovieExportToDataRef from MovieExportToFile
pascal ComponentResult MovieExportToFile(Globals store,
const FSSpec *theFile, Movie m, Track onlyThisTrack,
TimeValue startTime, TimeValue duration)
{
ComponentResult err;
AliasHandle alias;
err = QTNewAlias (theFile, &alias, true);
err = MovieExportToDataRef(store->self, (Handle)alias,
rAliasType, m, onlyThisTrack, startTime, duration);
DisposeHandle((Handle)alias);
}
Listing 14 example shows how to use the utility routines provided by the QuickTime movie data export component to implement MovieExportToDataRef by calling MovieExportFromProceduresToDataRef . Your implementation may differ, depending on the types of data to be exported. For example, the number and type of data sources created may change. This example creates a single sound data source, and is appropriate for any movie data export component that exports audio only.
Listing 14 Calling MovieExportFromProceduresToDataRef from MovieExportToDataRef
pascal ComponentResult MovieExportToDataRef(Globals store,
Handle dataRef, OSType dataRefType, Movie m,
Track onlyThisTrack, TimeValue startTime,
TimeValue duration)
{
ComponentResult err;
ComponentDescription cd;
ComponentInstance ci;
TimeScale scale;
MovieExportGetPropertyUPP getPropertyProc = nil;
MovieExportGetDataUPP getDataProc = nil;
void *refCon;
long trackID;
cd.componentType = MovieExportType;
cd.componentSubType = 'MooV';
cd.componentManufacturer = 0;
cd.componentFlags = canMovieExportFromProcedures;
cd.componentFlagsMask = canMovieExportFromProcedures;
err = OpenAComponent(FindNextComponent(nil, &cd), &ci);
err = MovieExportNewGetDataAndPropertiesProcs(ci,
SoundMediaType, &scale, m, onlyThisTrack,
startTime, duration,
&getPropertyProc, &getDataProc, &refCon);
err = MovieExportAddDataSource(store->self, SoundMediaType,
scale, &trackID, getPropertyProc, getDataProc,
refCon);
err = MovieExportFromProceduresToDataRef(store->self,
dataRef, dataRefType);
}
The code in Listing 14 retrieves default property and data procedures, instead of providing them, by using the QuickTime Movie export component. It also must dispose of these procedures. They take care of interpreting the tracks and returning media properties and data.
| Previous | Chapter Contents | Chapter Top | Next |